---
description: "Reference for Nitric's Python library - Retrieves the value from a version of a secret."
---

# Python - secret.version.access()

<Note>
  This is reference documentation for the Nitric Python SDK. To learn about
  Secrets in Nitric start with the [Secrets docs](/secrets).
</Note>

Retrieves the value from a version of a secret.

```python
from nitric.resources import secret
from nitric.application import Nitric

# Get latest secret version
latest = secret("database.password").allow("access").latest()

# Access the latest secret version
value = await latest_version.access()

Nitric.run()
```

## Examples

### Access the latest version of a secret

```python
from nitric.resources import secret
from nitric.application import Nitric

latest = secret("database.password").allow("access").latest()

value = await latest.access()

Nitric.run()
```

### Access a specific version of a secret

```python
from nitric.resources import secret
from nitric.application import Nitric

key_ref = secret('apiKey').allow('access')

key_value = await key_ref.version('the-version-id').access()

Nitric.run()
```
